package com.eric.learning.b.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenw-i
 * @version 1.0.0
 * @ClassName DemoController.java
 * @Description TODO
 * @createTime 2020年07月13日 16:56:00
 */
@RestController
public class DemoController {
    @Value("${spring.application.name:service-b}")
    String serviceName;

    @GetMapping("/get")
    public String get(){
        return serviceName+" get success";
    }

    @GetMapping("/exception")
    public String exception(){
        throw new RuntimeException("异常");
    }
    @GetMapping("/timeout")
    public String timeout(){
        try{
            Thread.sleep(1000);
        }catch (Exception e){
            e.printStackTrace();
        }

        return "timeout result .";
    }
}
